package com.ffcc.fitness.like.mapper;

import com.ffcc.fitness.like.pojo.entity.Like;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 点赞Mapper接口
 */
@Mapper
public interface LikeMapper {
    
    /**
     * 添加点赞
     */
    int insert(Like like);
    
    /**
     * 删除点赞
     */
    int deleteByUserAndTarget(@Param("userId") Long userId, 
                             @Param("targetId") Long targetId, 
                             @Param("targetType") Integer targetType);
    
    /**
     * 查询点赞数量
     */
    Long countByTarget(@Param("targetId") Long targetId, 
                      @Param("targetType") Integer targetType);
    
    /**
     * 查询用户是否已点赞
     */
    Like selectByUserAndTarget(@Param("userId") Long userId, 
                              @Param("targetId") Long targetId, 
                              @Param("targetType") Integer targetType);
}